﻿<%@ page language="java" import="java.util.*"
	contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@include file="/common/taglibs.jsp"%>
<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
	<title>后台管理-用户管理</title>
	<link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css">
	<link rel="stylesheet" href="/resources/src/css/admin/main.css" />
	<link rel="stylesheet" href="/resources/src/css/admin/user-manage.css" />
</head>
<body>
		<article class="main">
			<div class="main-wrapper">
				<section class="content">
					<div class="container">
						<form id="myForm" action="/admin/user/list">
						<div class="con-body">
							<div class="toolbar clearfix">
								<div class="toolbar-left pull-left">
									<a href="/admin/user/addUser" id="create" class="pull-left">新建</a>
									<a href="/admin/export/user" id="checkout" class="pull-right">导出</a>
								</div>
								<div class="toolbar-right pull-right text-right">
									<div class="input-icon pull-left">
										<input type="hidden" name="createTime" id="createTime" value="${user.createTime }" /> 
										<input type="hidden" name="endTime" id="endTime" value="${user.endTime }" />
										<input type="hidden" name="type" id="type" value="${user.type }" />
										<input type="text" name="condition" id="search" placeholder="输入用户名/手机/邮箱查询" value="${user.condition }"/>
										<i class="iconfont icon-sousuo" id="search-btn"></i>
									</div>
									<div class="input-icon marleft pull-left clearfix">
										<!--<label for="date">创建时间：</label>-->
										<div class="pull-left" style="position:relative;">
											<label for="date" class="iconfont icon-rili"></label>
											<span>创建时间：<span>
											<input type="text" id="date" placeholder="2017-12-11 14:12:13 - 2017-12-11 14:12:13"/>
										</div>
										<a class="pull-left" id="searchByDate" style="margin-left:20px;">查询</a>
									</div>
								</div>
							</div>
							<div class="user-table table-responsive">
								<table class="table">
									<thead>
										<tr>
											<th>用户名</th>
											<th data-toggle="joDropdown">
												用户类型<i class="iconfont icon-caidanshaixuan"></i>
												<ul data-toggle="joMenu">
													<li><a href="javascript:void(0);" onclick="typeSubmit(0)">全部</a></li>
													<li><a href="javascript:void(0);" onclick="typeSubmit(1)">机构</a></li>
													<li><a href="javascript:void(0);" onclick="typeSubmit(2)">投资者</a></li>
												</ul>	
											</th>
											<th>邮箱</th>
											<th>手机</th>
											<th>创建时间<i id="create-time" class="iconfont icon-paixu" data-order="0"></i></th>
											<th>最后登录时间<i id="login-time" class="iconfont icon-paixu" data-order="0"></i></th>
											<th>二维码</th>
											<th data-toggle="joDropdown">
												绑定状态<i class="iconfont icon-caidanshaixuan"></i>
												<ul data-toggle="joMenu">
													<li><a href="javascript:void(0);" onclick="statusSubmit(0);">全部</a></li>
													<li><a href="javascript:void(0);" onclick="statusSubmit(1);">已绑定</a></li>
													<li><a href="javascript:void(0);" onclick="statusSubmit(2);">未绑定</a></li>
												</ul>
											</th>
											<th>操作</th>
										</tr>
									</thead>
									<tbody  id="mytable">
									<c:forEach items="${pages.result }" var="user">
										<tr data-userId="255">
											<td>${user.userName }</td>
											<td>${user.type==1 ? '机构' : '投资人' }</td>
											<td>${user.email }</td>
											<td>${user.phone }</td>
											<td>${user.createTime }</td>
											<td>${user.lastLoginTime }</td>
											<td>
												<a data-src="/resources/src/images/qrcode.png" onclick="showQrcode(${user.id})">查看</a>
											</td>
											<td>
											<c:if test="${empty user.openId }">
												未绑定
											</c:if>
											<c:if test="${!empty user.openId }">
												<a onclick="unbind(${user.id})" value="${user.id }">已绑定</a>
											</c:if>
											</td>
											<td>
												<a href="/admin/user/edit/${user.id }">修改</a><a href="javascript:void(0);" onclick="lockingUser(${user.id},${user.status })">${user.status==1 ? '正常' : '已锁定' }</a><a onclick="resetPassword(${user.id})" value="${user.id }">重置密码</a>
											</td>
										</tr>
										</c:forEach>
										<tr>
										<td colspan="9" style="border:0"><jsp:include page="/common/adminPage.jsp" /></td>
										</tr>
									</tbody>
								</table>		
							</div>
						</div>
						</form>
					</div>
				</section>
			</div>
		</article>
		
		<!-- 查看二维码模态框 -->
		<div class="joModal" id="qrcode-modal">
			<div class="joModal-dialog">
				<div class="joModal-content" data-liffect="slideTop">
					<div class="joModal-header joClose" data-modal="close" >
						<i class="iconfont icon-cuowu"></i>
					</div>
					<div class="joModal-body">
						<div id="showqrcode"></div>
						<!-- <img id="qrcode" src="/resources/src/images/qrcode.png" width="205" height="205" alt="二维码" /> -->
						<p>右键另存为，保存二维码</p>
					</div>
				</div>
			</div>	
		</div>
		
		<!-- 解绑模态框 -->
		<div class="joModal" id="unbind-modal">
			<div class="joModal-dialog">
				<input type="hidden" id="wuserId" value=""/>
				<div class="joModal-content" data-liffect="slideTop">
					<div class="joModal-body">
						<p class="text-tip">是否把该账号与其微信号解除绑定？</p>
					</div>
					<div class="joModal-footer clearfix">
						<a class="pull-left cancel modal-btn" data-modal="close" >取消</a>
						<a class="pull-left confirm modal-btn" id="unbindWeChat">确定</a>
					</div>
				</div>
			</div>	
		</div>
		
		<!-- 密码重置模态框 -->
		<div class="joModal" id="reset-modal">
			<div class="joModal-dialog">
				<input type="hidden" id="puserId" value=""/>
				<div class="joModal-content" data-liffect="slideTop">
					<div class="joModal-body">
						<p class="text-tip">是否重置该账号密码为123456？</p>
					</div>
					<div class="joModal-footer clearfix">
						<a class="pull-left cancel modal-btn" data-modal="close" >取消</a>
						<a class="pull-left confirm modal-btn" id="rePassword">确定</a>
					</div>
				</div>
			</div>	
		</div>
		
		<script src="/resources/src/js/jquery-2.1.4.js"></script>
		<script src="/resources/src/js/bootstrap.min.js"></script>
		<script src="/resources/src/js/jquery.nicescroll.js"></script>
		<script src="/resources/src/js/admin/main.js"></script>
		<script src="/resources/src/js/moment.min.js"></script>
		<script src="/resources/src/js/daterangepicker.js"></script>
		<script src="/resources/src/js/jquery.qrcode.min.js"></script>
		<script src="/resources/src/js/admin/userManage.js"></script>
		<script src="/resources/src/js/adminPage.js"></script>
 	</body>
</html>